package org.jeecg.modules.rental.enums;

import org.jeecg.common.annotation.EnumDict;
import org.jeecg.common.enums.IEnumDict;
import org.jeecg.common.exception.JeecgBootException;

@EnumDict(code ="rental_packages_type", name = "租车套餐类别")
public enum PackagesTypeEnums implements IEnumDict<PackagesTypeEnums> {
//
//    MINUTE("1", "按分计费", "分钟",  "minute", MinutePackages.class),
//
//    HOURS("2", "按小时计费", "小时","hour", HoursPackages.class),
//
//    DAILY("3", "按天计费", "天","day", DailyPackages.class),
//
//    MONTH("4", "按月计费", "月","month", MonthPackages.class);

    MINUTE("1", "按分计费", "分钟",  "minute"),

    HOURS("2", "按小时计费", "小时","hour"),

    DAILY("3", "按天计费", "天","day"),

    MONTH("4", "按月计费", "月","month");

    private String value;

    private String label;

    private String unit;

    /**
     * 不一定要有，为了前端vue渲染有个key
     */
    private String key;

//    private Class clazz;

//    PackagesTypeEnums(String value, String label, String unit, String key, Class clazz) {
//        this.value = value;
//        this.label = label;
//        this.unit = unit;
//        this.key = key;
//        this.clazz = clazz;
//    }

    PackagesTypeEnums(String value, String label, String unit, String key) {
        this.value = value;
        this.label = label;
        this.unit = unit;
        this.key = key;
    }

    @Override
    public String getValue() {
        return value;
    }

    @Override
    public String getLabel() {
        return label;
    }

    public String getUnit() {
        return unit;
    }

    @Override
    public String getKey() {
        return key;
    }

    @Override
    public String getRemark() {
        return null;
    }

//    public Class getClazz() {
//        return clazz;
//    }

    public static PackagesTypeEnums getEnumByValue(String value){
        for(PackagesTypeEnums item: values()){
            if(value.equals(item.value)){
                return item;
            }
        }
        throw new JeecgBootException("没找到对应字典");
    }

}
